import type { UploadUserFile } from "element-plus";
/*
  {
    "records": [
      {
        "id": 9390,
        "spuName": "色蓝",
        "description": "45456661",
        "category3Id": 1,
        "tmId": 24405,
        "spuSaleAttrList": null,
        "spuImageList": null
      }
    ],
    "total": 2,
    "size": 1,
    "current": 1,
    "searchCount": true,
    "pages": 2
  }
*/

/* [
  {
    "category3Id": 0,
    "description": "string",
    "id": 0,
    "spuImageList": [
      {
        "id": 0,
        "imgName": "string",
        "imgUrl": "string",
        "spuId": 0
      }
    ],
    "spuName": "string",
    "spuSaleAttrList": [
      {
        "baseSaleAttrId": 0,
        "id": 0,
        "saleAttrName": "string",
        "spuId": 0,
        "spuSaleAttrValueList": [
          {
            "baseSaleAttrId": 0,
            "id": 0,
            "isChecked": "string",
            "saleAttrName": "string",
            "saleAttrValueName": "string",
            "spuId": 0
          }
        ]
      }
    ],
    "tmId": 0
  }
] */
// /admin/product/inner/findSpuInfoBySpuIdList

export interface SpuSaleAttrValueItem {
  baseSaleAttrId: number;
  saleAttrValueName: string;
  id?: number;
  // isChecked: string;
  // saleAttrName: string;
  // spuId: number;
}
export type SpuSaleAttrValueList = SpuSaleAttrValueItem[];

export interface SpuSaleAttrItem {
  baseSaleAttrId: number;
  saleAttrName: string;
  spuSaleAttrValueList: SpuSaleAttrValueList;
  isEdit?: boolean;
  id?: number;
  // spuId: number;
}
export type SpuSaleAttrList = SpuSaleAttrItem[];

export interface SpuImageItem {
  id?: number;
  imgName: string;
  imgUrl: string;
  // spuId: number;
  // isDefault: string;
}

export type SpuImageList = SpuImageItem[];

export interface CommonSpu {
  id?: number;
  spuName: string;
  description: string;
  spuSaleAttrList: SpuSaleAttrList;
}

export interface GetSpuFormDataItem extends CommonSpu {
  tmId: number;
  category3Id: number;
  spuImageList: SpuImageList;
}

export interface SpuFormData extends CommonSpu {
  tmId: undefined | number;
  spuImageList: UploadUserFile[];
}

export interface GetSpuListParams {
  page: number;
  limit: number;
  category3Id: number;
}

export interface SpuItem {
  id?: number;
  spuName: string;
  description: string;
  //   category3Id: number;
  tmId: number;
  //   spuSaleAttrList: SpuSaleAttrList;
  //   spuImageList: UploadUserFile[];
}

export type SpuList = SpuItem[];

export interface GetSpuListResponse {
  records: SpuList;
  total: number;
  // size: number;
  // current: number;
  // searchCount: true;
  // pages: number;
}

// 销售属性列表类型
export interface BaseSaleAttrItem {
  id: number;
  name: string;
}

export type BaseSaleAttrList = BaseSaleAttrItem[];
